package com.mo.lib.utils.view

import android.graphics.Paint
import android.widget.TextView

/**
 * @ author：mo
 * @ data：2021/9/14:16:12
 * @ 功能：TextView相关扩展
 */

/** 设置下划线*/
fun TextView.setUnderline(str: String?) {
    str?.let {
        this.text = it
    } //下划线
    this.paint.flags = Paint.UNDERLINE_TEXT_FLAG //抗锯齿
    this.paint.isAntiAlias = true
}

/** 设置删除线*/
fun TextView.setDeleteLine() {
    this.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG or Paint.ANTI_ALIAS_FLAG
}

/** 设置首行缩进*/
fun TextView.setTextIndent(str: String) {
        this.text = StringBuffer("\u3000\u3000").append(str)
}
